#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QSerialPort>
#include <QSerialPortInfo>
#include "Serialport.h"
#include "common.h"

QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow(QWidget *parent = nullptr);
    ~MainWindow();

    virtual void timerEvent(QTimerEvent *);
    void SerialCMD(unsigned char*cmd,int size);
    void on_update_serial_data();

private:
    void sendMeasureData(int type);
    int getRand(int min, int max);

private slots:
    void on_pushButton_connect_serial_clicked(bool checked);

    void on_pushButton_search_serial_clicked();

private:
    Ui::MainWindow *ui;
    int time_id2s;
    int time_id200ms;
    MEASURE_MODE measure_mode;
    int m_send_type;
    int m_send_count;
};
#endif // MAINWINDOW_H
